<template>
    <div class="app-container">
      <div class="header">
        <el-button type="primary" icon="el-icon-edit" @click="add">增加</el-button>

      </div>
    <el-table
      stripe
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="warehouseID" align="center"
        label="仓库ID"
        width="180">
      </el-table-column>
      <el-table-column
        prop="warehouseName"
        label="仓库名称" align="center"

        width="180">
      </el-table-column>
      <el-table-column
        prop="warehouseAddress" align="center"
        label="仓库地址">
      </el-table-column>
      <el-table-column
        label="操作" align="center">
        <template slot-scope="scope">
          <el-button size="mini" @click="update" type="primary">修改</el-button>
          <el-button size="mini" @click="del" type="danger">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
<!--      添加仓库信息弹窗-->
      <el-dialog
      title="添加仓库信息" :visible.sync="dialogVisible">
        <el-form inline label-width="120" ref="form" size="small">
          <el-form-item prop="warehouseID" label="仓库ID">
            <el-input type="text" v-model="warehouse.warehouseID" clearable></el-input>
          </el-form-item>
          <el-form-item prop="warehouseName" label="仓库名称">
            <el-input type="text" v-model="warehouse.warehouseName" clearable></el-input>
          </el-form-item>
          <el-form-item prop="warehouseAddress" label="仓库地址">
            <el-input type="text" v-model="warehouse.warehouseAddress" clearable></el-input>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submit">确 定</el-button>
      </span>
      </el-dialog>
<!--      修改仓库信息弹窗-->
      <el-dialog
        title="修改仓库信息" :visible.sync="dialogVisible11">
        <el-form inline label-width="120" ref="form" size="small">
          <el-form-item prop="warehouseID" label="仓库ID">
            <el-input type="text" v-model="warehouse.warehouseID" clearable></el-input>
          </el-form-item>
          <el-form-item prop="warehouseName" label="仓库名称">
            <el-input type="text" v-model="warehouse.warehouseName" clearable></el-input>
          </el-form-item>
          <el-form-item prop="warehouseAddress" label="仓库地址">
            <el-input type="text" v-model="warehouse.warehouseAddress" clearable></el-input>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible11 = false">取 消</el-button>
        <el-button type="primary" @click="submit1">确 定</el-button>
      </span>
      </el-dialog>
    </div>
  </template>

<script>
export default {
 data(){
   return{
     tableData:[{
       warehouseID:'0001',
       warehouseName: '成品仓库',
       warehouseAddress:'一栋-1楼-001'
     },
       {
         warehouseID:'0002',
         warehouseName: '原料仓库',
         warehouseAddress:'一栋-1楼-002'
       },
       {
         warehouseID:'0003',
         warehouseName: '原料仓库',
         warehouseAddress:'一栋-1楼-003'
       },
     ],
     warehouse:{
       warehouseID:'',
       warehouseName:'',
       warehouse:''
     },
     dialogVisible:false,
     dialogVisible11:false
   }
 },

 methods:{
   add(){
this.dialogVisible=true
   },
   update(){
      this.dialogVisible11=true
   },
   del(){
     this.$confirm('是否删除该仓库?', '提示', {
       confirmButtonText: '确定',
       cancelButtonText: '取消',
       type: 'warning'
     }).then(() => {
       this.$message({
         type: 'success',
         message: '删除仓库成功!'
       });
     }).catch(() => {
       this.$message({
         type: 'info',
         message: '已取消删除'
       });
     });
   },
   submit(){

   },
   submit1() {
   }
 }
}
</script>

<style scoped>

</style>
